{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sparkfun - Grove I2C Environment Sensor module\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aim\n",
    "\n",
    "* This notebook illustrates how to use available APIs for the Sparkfun Qwiic I2C Environment Sensor module along with Qwicc to grove adaptor on PYNQ-Z2 PMOD py_interfaces.\n",
    "\n",
    "\n",
    "## References\n",
    "* [Sparkfun Environment_Sensor](https://www.sparkfun.com/products/16466)   \n",
    "* [Sparkfun qwiic to grove connector](https://www.sparkfun.com/products/15109)   \n",
    "* [PYNQ Grove Adapter](https://store.digilentinc.com/pynq-grove-system-add-on-board/)   \n",
    "* [Grove Base Shield V2.0](https://www.seeedstudio.com/Base-Shield-V2.html)   \n",
    "\n",
    "## Last revised\n",
    "* 31 July 2021\n",
    "    + Initial version\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Install Driver for grove_envsensor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%%bash\n",
    "cp -r ../../grove_envsensor /usr/local/lib/python3.6/dist-packages/pynq_peripherals/modules/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Load _base_ Overlay"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"alert alert-box alert-info\">\n",
    "Note that we load the base bitstream only once to use Grove module with PYNQ Grove Adapter and SEEED Grove Base Shield V2.0<br>\n",
    "Please make sure you run the following cell before running either of the py_interfaces \n",
    "</div>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%microblaze/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%pybind11/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from pynq.overlays.base import BaseOverlay\n",
    "from pynq_peripherals import ArduinoSEEEDGroveAdapter, PmodGroveAdapter\n",
    "base = BaseOverlay('base.bit')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using Sparkfun - Qwiic - Grove I2C Environment Sensor with Grove Base Shield V2.0 (Arduino)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"alert alert-box alert-warning\"><ul>\n",
    "    <h4 class=\"alert-heading\">Make Physical Connections </h4>\n",
    "    <li>Insert the SEEED Grove Base Shield py_into the Arduino connector on the board. Connect Qwiic side of cable to Sparkfun Environment Sensor and the grove side to one of the connectors labeled I2C.</li></ul>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Adapter configuration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "adapter=ArduinoSEEEDGroveAdapter(base.ARDUINO, I2C='grove_envsensor')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define device object"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "envsensor = adapter.I2C"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Reading from Sparkfun Environment Sensor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature = 28.459999084472656 °C, Pressure = 846.76 hPa, Humidity = 45.124000549316406 % r.H.\n"
     ]
    }
   ],
   "source": [
    "# Initialize the sensor \n",
    "if (not envsensor.init()):\n",
    "    print(\"Sensor configuration failed\")\n",
    "#read temperature\n",
    "temp = envsensor.read_temperature() \n",
    "#read pressure\n",
    "pres = envsensor.read_pressure() \n",
    "#read humidity\n",
    "humd = envsensor.read_humidity() \n",
    "print(f\"Temperature = {temp} °C, Pressure = {pres/100} hPa, Humidity = {humd} % r.H.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "## Using Sparkfun - Qwiic - Grove I2C Environment Sensor with PYNQ Grove Adapter (PMOD)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"alert alert-box alert-warning\"><ul>\n",
    "    <h4 class=\"alert-heading\">Make Physical Connections </h4>\n",
    "    <li>Connect the PYNQ Grove Adapter to PMODB connector.  Connect Qwiic side of cable to Sparkfun Environment Sensor and the grove side to the G3 connector of the Adapter.</li></ul>\n",
    "</div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Adapter configuration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%microblaze/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/javascript": [
       "\n",
       "try {\n",
       "require(['notebook/js/codecell'], function(codecell) {\n",
       "  codecell.CodeCell.options_default.highlight_modes[\n",
       "      'magic_text/x-csrc'] = {'reg':[/^%%pybind11/]};\n",
       "  Jupyter.notebook.events.one('kernel_ready.Kernel', function(){\n",
       "      Jupyter.notebook.get_cells().map(function(cell){\n",
       "          if (cell.cell_type == 'code'){ cell.auto_highlight(); } }) ;\n",
       "  });\n",
       "});\n",
       "} catch (e) {};\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from pynq.overlays.base import BaseOverlay\n",
    "from pynq_peripherals import ArduinoSEEEDGroveAdapter, PmodGroveAdapter\n",
    "base = BaseOverlay('base.bit')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "adapter=PmodGroveAdapter(base.PMODB, G3='grove_envsensor')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Define device object"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "envsensor=adapter.G3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Reading from Sparkfun Environment Sensor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Temperature = 28.579999923706055 °C, Pressure = 846.72 hPa, Humidity = 45.972999572753906 % r.H.\n"
     ]
    }
   ],
   "source": [
    "# Initialize the sensor \n",
    "if (not envsensor.init()):\n",
    "    print(\"Sensor configuration failed\")\n",
    "#read temperature\n",
    "temp = envsensor.read_temperature() \n",
    "#read pressure\n",
    "pres = envsensor.read_pressure() \n",
    "#read humidity\n",
    "humd = envsensor.read_humidity() \n",
    "print(f\"Temperature = {temp} °C, Pressure = {pres/100} hPa, Humidity = {humd} % r.H.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot temperature on graph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[28.770000457763672, 29.079999923706055, 29.18000030517578, 29.809999465942383, 31.299999237060547, 31.899999618530273, 31.350000381469727, 30.760000228881836, 30.420000076293945, 30.25]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEICAYAAABWJCMKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3Xl8VNX5x/HPk4UkQEhYEkISdpCwJkAERaWCsmiroFWrKG5tcaNurdb6a2u12trFtWqta1WwLqDiBhR3QQskAUIgLJE1ISEJZCd7nt8fM2hKA5lAkjuTed6vV17M3Myd+c6QmWfuOeeeI6qKMcYY/xPgdABjjDHOsAJgjDF+ygqAMcb4KSsAxhjjp6wAGGOMn7ICYIwxfsoKgDE+TkQSRKTO6RzG91gBMG1GRMob/TSISGWj65c7ne9EiEieiJzejo830/0alotImYhkisgVx3E/D4rIc22R0fieIKcDmI5LVbseviwiu4CfqOpHziXyjIgEqWqbfqM+zsfYoapDRESAi4FXReTrNohn/IQdARjHiEigiPxGRHaISKGILBSRSPfvEkSkTkR+LCI5InJARK4VkUkikiEixSLycKP7ul5EPhGRf4hIqYhsFpHJjX7fQ0Redn9z3ysi94hIwBH7PikiRcBd7sf/TEQOikiBiLwkIuHu278JRAP/dn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xgBXCYiI5xN5Zg64OeqOgI4BbjJj1+Lw24BMp0O4QUeA5apagKQiJ++JiISB9wMJKvqKCAQuNTZVO3qn8DMI7bdBXysqkOBj93Xj8lrCgAwAchS1R2qWgO8BsxyOJMjVDVXVdPcl8twvcnjnE3lHBGJB74PPOd0FieJSAQwGXgeQFVrVLXY2VSOCgLCRCQI6AzsczhPu1HVL4CDR2yeBbzkvvwSMLu5+/GmAhAH7G10PRs//tA7TEQGAGOB1c4mcdSjwJ1Ag9NBHDYQKABedDeHPSciXZwO5QRVzQH+CuwBcoESVf23s6kc11tVc92X84Deze3gTQXAHEFEugKLgVtVtdTpPE4QkR8A+aqa6nQWLxAEjAP+rqpjgQo8OMzviNzt27NwFcVYoIuIXOFsKu+hrvH9zY7x96YCkAP0bXQ93r3NL4lIMK4P/4Wq+pbTeRx0GnC+iOzC1Sw4VUQWOBvJMdlAtqoePhpchKsg+KOzgZ2qWqCqtcBbwCSHMzltv4j0AXD/m9/cDt5UANYCQ0VkoIh0wtWh867DmRwhIoKrnTdTVR92Oo+TVPVXqhqvqgNw/U18oqp++U1PVfOAvSIyzL3pLGCzg5GctAc4RUQ6u98vZ+GnHeKNvAtc5b58FbCkuR28ZjZQVa0TkfnAclw9+i+o6iaHYznlNGAusFFE1ru33a2qHzqYyXiHnwEL3V+SdgDXOJzHEaq6WkQWAWm4Rs2tw4+mhRCRfwFnAr1EJBu4B3gQeENEfgzsBi5p9n5sKghjjPFP3tQEZIwxph1ZATDGGD9lBcAYY/yUFQBjjPFTVgCMMcZPWQEwxhg/ZQXAGGP81P8DGNweILkvmVoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xac6061d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from time import sleep\n",
    "import time\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "temp = []\n",
    "sample = 10\n",
    "while (sample):\n",
    "    temp.append(envsensor.read_temperature())\n",
    "    sleep(0.5)\n",
    "    sample -= 1\n",
    "\n",
    "print(temp)\n",
    "plt.plot(range(len(temp)), temp)\n",
    "plt.title('Temperature Plot')\n",
    "min_tmp_log = min(temp)\n",
    "max_tmp_log = max(temp)\n",
    "plt.axis([0, len(temp), min_tmp_log, max_tmp_log])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Copyright (C) 2021 Xilinx, Inc\n",
    "\n",
    "SPDX-License-Identifier: BSD-3-Clause"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "----"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "----"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
